<!--
 * @Description: 
 * @Author: zhanyinjia
 * @Date: 2022-11-15 13:39:24
 * @LastEditors: zhanyinjia
 * @LastEditTime: 2022-12-12 15:36:32
-->
<template>
  <div>
    <div class="excel1">
      <h4>普通格式excel</h4>
      <img src="@/assets/images/excel1.png" alt="" style="width: 100%" />
    </div>
    <div class="excel2">
      <h4>特殊格式excel</h4>
      <img src="@/assets/images/excel2.png" alt="" />
    </div>
    <el-button type="primary" @click="downloadExcel">下载excel</el-button>
    <el-button type="primary" @click="downloadZip">下载zip</el-button>
  </div>
</template>

<script>
import { createArrayWs, createSpecialWs, saveSheet } from './exportWs'
import { exportZip } from './zip'

export default {
  name: 'Excel',
  data() {
    return {}
  },
  methods: {
    downloadExcel() {
      const ws1 = createArrayWs()
      const ws2 = createSpecialWs()
      saveSheet([ws1, ws2], '供应商物料和发票.xlsx')
    },
    downloadZip() {
      const ws1 = createArrayWs()
      const ws2 = createSpecialWs()

      let list = []
      for (let i = 1; i < 51; i++) {
        list.push({
          fileName: `中药资源${i}.xlsx`,
          sheetList: [ws1, ws2]
        })
      }
      exportZip('中药资源.zip', list)
    }
  }
}
</script>

<style lang="scss" scoped>
</style>